Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend HTML mode - persist checkbox value and use across views #135

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

irenejoeunpark
Copy link

This PR is an additional feature to issue #101.
Created method to store asHtml in store.ts and use that value in Code.vue.
If you check/uncheck the Html checkbox in one view, it applies to all other views.

@MichaelCurrin MichaelCurrin changed the title #Issue101 - Add store html checkbox value and apply for all views. Extend HTML mode - persist checkbox value and use across views Nov 26, 2021
src/store.ts Outdated Show resolved Hide resolved
@@ -1,5 +1,7 @@
import Code from "@/components/Code.vue";
import { shallowMount } from "@vue/test-utils";
import store from "@/store";

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -1,5 +1,7 @@
import Code from "@/components/Code.vue";
import { shallowMount } from "@vue/test-utils";
import store from "@/store";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit needs to be actually used.

Also please run tests and fix them. The Code component needs to switch between HTML and Markdown mode in the tests.

This file is failing.

This old code is like this:

      data() {
        return {
          asHtml: true,
        };
      },

I tried adding this and it didn't work.


    wrapper.setData({ asHtml: true })
    store.setAsHtml(true)

Copy link
Owner

@MichaelCurrin MichaelCurrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix failing tests

@MichaelCurrin
Copy link
Owner

MichaelCurrin commented Nov 26, 2021

Also a problem I found is that the checkbox only syncs across views - I'd like it to sync within the Catalogue view across checkboxes.

So maybe the asHtml boolean is passed in as a prop to the component. That will make the tests easier.
And also then the Catalogue page can have an asHtml value which is passed to all components, so they all share the same value. Events will be needed to sync them.

I tried this global approach but had errors

https://stackoverflow.com/a/54882568/6250733

@irenejoeunpark
Copy link
Author

Also an problem I found is that the checkbox only syncs across views - I'd like it to sync within the Catalogue view across checkboxes.

So maybe the asHtml boolean is passed in as a prop to the component. That will make the tests easier. And also then the Catalogue page can have an asHtml value which is passed to all components, so they all share the same value. Events will be needed to sync them.

I tried this global approach but had errors

https://stackoverflow.com/a/54882568/6250733

Also an problem I found is that the checkbox only syncs across views - I'd like it to sync within the Catalogue view across checkboxes.

So maybe the asHtml boolean is passed in as a prop to the component. That will make the tests easier. And also then the Catalogue page can have an asHtml value which is passed to all components, so they all share the same value. Events will be needed to sync them.

I tried this global approach but had errors

https://stackoverflow.com/a/54882568/6250733

Thanks for noticing those! I will give you a fix as soon as I finish them.
And how do I run the test?

@MichaelCurrin
Copy link
Owner

https://github.com/MichaelCurrin/badge-generator/blob/master/docs/usage.md#tests

Or on Windows

yarn test

Also note the checks at the bottom of the conversation with green ticks and then a red cross for the failing tests on GitHub Actions

@MichaelCurrin
Copy link
Owner

Let me know if you need more info to complete this. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants